list content with attributes#332
Conversation
(cherry picked from commit 14c2dbbb5ed94766545bf759e6b4db445cc4cf92)
|
@jacalata is going to rebase these off the latest |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add all() method to getter mock objects to support ListCommand functionality - Add machine attribute to test args to prevent AttributeError - Set up proper server object mocks (workbooks, projects, datasources, flows) - Fixes failing tests in test_run_commands.py and test_listing_commands.py (thanks to Cursor for the assist)
|
@jacalata I added a commit here to fix the tests. Please double-check me on that and if it looks good we can both approve and then merge :) |
Added some unit tests for coverage
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the 'list' command functionality by adding new options to display additional attributes beyond just ID and name, addressing issue #268. The enhancement provides users with more control over what information is displayed when listing content.
Key changes:
- Added new command-line arguments for controlling display attributes (
--machine,--name,--owner,--details,--address) - Implemented header generation and formatted output for different content types
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tabcmd/commands/site/list_command.py | Core implementation of new listing attributes and formatting logic |
| tabcmd/locales/en/tabcmd_messages_en.properties | Added localization strings for headers, labels, and help text |
| tests/commands/test_listing_commands.py | Added comprehensive test coverage for new functionality |
| tests/commands/test_run_commands.py | Updated existing tests to support new command arguments |
| tests/commands/test_session.py | Moved slow integration test and added explanatory comment |
| tests/commands/test_publish_command.py | Minor formatting cleanup (removed extra blank line) |
Comments suppressed due to low confidence (3)
tabcmd/commands/site/list_command.py:61
- The variable name 'id' shadows the built-in Python function. Consider renaming it to 'item_id' or 'content_id' to avoid confusion.
id = item.id
tabcmd/commands/site/list_command.py:72
- The variable name 'id' shadows the built-in Python function. Consider renaming it to 'item_id' or 'content_id' to avoid confusion.
id = _("tabcmd.listing.label.id").format(item.id)
tabcmd/commands/site/list_command.py:102
- The variable name 'id' shadows the built-in Python function. Consider renaming it to 'id_header' or 'header_id' to avoid confusion.
id = _("tabcmd.listing.header.id")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
this will need test updates too Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The 'list' methods only show an ID and name, which isn't always enough.. Fixing #268
These are the new arguments
list:
{projects,workbooks,datasources,flows}
View content
--machine Format output as csv for machine reading
Attributes to display:
-a, --address Show web address of the item
--children Show children of the item
-d, --details Show all attributes of the item
-n, --name Show item name
-o, --owner Show item owner